package T.RunM;

/**
 * <T extends Runco>，这样改的意思是指，T泛型代表任意实现或继承Runco接口的具体类型
 * 泛型声明<T extends Runnable>意味着T类型必须是Runnable接口的子接口或实现类。更一般化的，可以是<T extends Parent>，Parent可以是接口，抽象类或一般类。T具体类型必须是Parent的子类或实现类或Parent自身。
 * @author zhiqi.shao
 * @Date 2018/5/31 11:27
 */
public class Driver<T extends Runco> {

    private T conveyance;

    public void drive(T conveyance) {
        this.conveyance=conveyance;
        System.out.println("I am driving a " + conveyance);
        conveyance.run();
    }

    public T getConveyance() {
        return conveyance;
    }
}
